<template>
	<view class="mt80 bgtmert">
		<view class="pd">
			<view class=" pr">
				<icon type="search" class="jhggsd" size="20"></icon>
				<input type="text" value="" placeholder="输入地区搜索" class="jhhgerttyt ag" />
			</view>
			<!-- <view class="mt40">
				<uni-icons type="map" color="#1689D5" size="20"></uni-icons>
				<text class="ml10 cf fz26">当前定位：山东省</text>
			</view> -->
		</view>

		<uni-list class="mt50 ">
			<uni-list-item title=""  @tap="getcitys(sd.id,sd.name)"  v-for="(sd,idx) in datas" :key="idx" >{{sd.name}}</uni-list-item>
		</uni-list>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				datas:[],
				province:""
			}
		},
		components: {},
		onNavigationBarButtonTap(e) {
			uni.navigateBack({
				delta:1
			})
		},
		methods: {
			async getssq(type,id){
				let urls = '/api/region/'+type
				if (id) {
					urls = urls+"/"+id
				}
				let datas =  await this.get(urls)
				uni.showLoading()
				this.datas = datas.data
				uni.hideLoading()
			},
			getcitys(pid,name){
				uni.$emit('address', {'type':2,id:pid,name:name});
				uni.navigateTo({
					url:'areas?province='+this.province+'&pid='+pid
				})
			}
		},
		onLoad(options) {
			console.log(options);
			let pid = options.pid
			this.province=options.pid
			this.getssq(2,pid)
		},
		mounted() {}
	}
</script>
<style scoped>
	.jhhgerttyt.ag {
		padding-left: 120upx !important;
	}

	.jhggsd {
		position: absolute;
		left: 36upx;
		top: 30upx;
	}
</style>
